package com.example.pre.service.impl;

import java.util.Collection;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.pre.dao.DepartmentDao;
import com.example.pre.model.Department;
import com.example.pre.service.DepartmentService;

/*
 *部门service层实现类 
 */
@Service
public class DepartmentServiceImpl implements DepartmentService {

	@Autowired
	private DepartmentDao departmentDao;

	@Override
	public Department get(int id) {
		return departmentDao.get(id);
	}

	@Override
	public Collection<Department> getAll() {
		return departmentDao.listByCondition(null);
	}

	@Override
	public boolean update(Department m) {
		return departmentDao.update(m) == 1;
	}

	@Override
	public boolean delete(int id) {
		return departmentDao.delete(id) == 1;
	}

	@Override
	public boolean create(Department m) {
		return departmentDao.create(m) == 1;
	}

	@Override
	public Collection<Department> listByCondition(Map<String, Object> whereColumn) {
		return departmentDao.listByCondition(whereColumn);
	}

	@Override
	public int countByCondition(Map<String, Object> whereColumn) {
		return departmentDao.countByCondition(whereColumn);
	}

}
